<script setup>
import { ref, onMounted } from 'vue';
import { useRouter } from 'vue-router';

const router = useRouter();
const countdown = ref(5);

onMounted(() => {
  const interval = setInterval(() => {
    if (countdown.value > 0) {
      countdown.value -= 1;
    } else {
      clearInterval(interval);
      router.push('/');
    }
  }, 1000);
});
</script>

<template>
  <div class="">
    <el-result
        icon="success"
        sub-title="您购买的内容已保存到游戏库中，请注意查收">
      <template #title>
        <span style="color: #c6d4df; font-size: 20px;">支付成功</span>
      </template>
      <template #extra>
        <div>
          <el-button @click="router.push('/')" type="primary">主页</el-button>
          <p style="color: #7092a5">倒计时 {{ countdown }} 秒后返回主页</p>
        </div>
      </template>
    </el-result>
  </div>
</template>

<style scoped>
</style>
